package com.qyhl.webtv.module_news.news.information.info;


import com.qyhl.webtv.commonlib.entity.news.SectionBean;

import java.util.List;

/**
 * Created by qyhl on 2017/11/28.
 */

public class InformationPresenter implements InformationContract.InformationPresenter {
    private InformationActivity mView;
    private InformationModel mModel;

    public InformationPresenter(InformationActivity mView) {
        this.mView = mView;
        this.mModel = new InformationModel(this);
    }

    @Override
    public void getData(String id, String type) {
        mModel.getData(id, type);
    }

    @Override
    public void setError(int code, String msg) {
        switch (code) {
            case 0:
                mView.setNetError(msg);
                break;
            case 1:
                mView.setError(msg);
                break;
            case 2:
                mView.setEmpty(msg);
                break;
            default:
                break;
        }
    }

    @Override
    public void setData(List<SectionBean> beanList) {
        mView.setData(beanList);
    }
}
